// pages/salebuy/salebuy.js
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    yhmdpng:0
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
  var that = this 
  wx.getSystemInfo({
    success: function(res) {
      that.setData({
        yhmdpng:res.windowHeight
      })
    },
  })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that = this
    wx.login({
      success(res) {
        // that.data.userInfo.code = res.code;
        console.log(res.code);
        that.setData({
          userInfo: {
            code: res.code
          }
        })
      }
    })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },
  nainfo:function(){
wx.navigateTo({
  url: '../../pages/actioninfo/actioninfo',
  success: function(res) {},
  fail: function(res) {},
  complete: function(res) {},
})
  },
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },
getsaleinfo(){
var userid = wx.getStorageSync("userid")
wx.request({
  url: app.globalData.url +'/wxpay/tryToRide?activityId=1',
  data: { userId: userid},
  success(res){
    console.log(res.data)
    if (res.data.activity=='1'){
      wx.showModal({
        title: '提示',
        content: res.data.msg,
        showCancel:false
      })
    } else if (res.data.activity=='-1'){
wx.showModal({
  title: '提示',
  content: res.data.msg,
  showCancel: false
})
    }
  }
})
},
  /**
   * 用户点击右上角分享
   */
  // onShareAppMessage: function () {
  
  // },
  access() {
   var that = this

        that.getsaleinfo()
     
    
  },
})